package net.zhangyun.utils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class MyConsole {

    private static Logger logger = LoggerFactory.getLogger("MyConsole");

    public static <T> void printSingle(T result) {
        logger.info("Result: {}", result);
    }

    public static <T> void printMessage(T result) {
        logger.info("Message: {}", result);
    }

    public static <T> void printError(T result) {
        logger.info("Error: {}", result);
    }

    public static <T> void printSingleLambda(SingleValueFunction<T> lambda) throws Exception {
        long start = System.currentTimeMillis();
        T result = lambda.compute();
        long cost = System.currentTimeMillis() - start;
        logger.info("Result: {}, cost {} ms", result, cost);
    }

    public static void printDivider() {
        logger.info("============================================================");
    }
}
